/*
 * BBDUTBroker.java
 * 
 * Created on May 21, 2007, 9:30:23 PM
 * 
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package admin.broker;
/*
 * Copyright 2007 microneering, Inc and James Gamber
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 * 
 * BBDAdmin/admin.broker/BBDUTBroker.java
 */
import java.sql.SQLException;
import java.util.logging.Logger;

import bbd.BBDAPI;
import bbd.BBDAPIPrincipal;
import bbd.BBDBroker;
import bbd.BBDConnection;
import bbd.BBDRow;
import bbd.BBDRowArrayList;


/**
 *
 * @param R 
 * @param L 
 * @author james gamber
 */
public class BBDUTBroker <R extends BBDRow, L extends BBDRowArrayList<R>>
		implements BBDBroker<R, L> {
    
	static final Logger log = Logger.getLogger(BBDSPBroker.class.getName());

	/**
	 * Keys used to find the API SQL
	 */
	 private final BBDAPI<R> SELECT = new BBDAPI<R>("bbd", "getUTs");
//	 private final BBDAPI<R> INSERT = new BBDAPI<R>("bbd", "XXX");
//	 private final BBDAPI<R>UPDATE = new BBDAPI<R>("bbd", "XXX");
//	 private final BBDAPI<R> DELETE = new BBDAPI<R>("bbd", "XXX");

	 private BBDAPIPrincipal userAccess =  new BBDAPIPrincipal("?","?");

    public BBDUTBroker() {
    }

	public L select(final R row) {
            
            
		SELECT.setBbdPrincipal(userAccess);

		final BBDConnection<R, L> myConnection = new BBDConnection<R, L>();
		L list = (L)new BBDRowArrayList<R>();
		try {
			list = myConnection.executeQuery(SELECT);
		} catch (final SQLException e) {
			log.severe(e.toString());
		}

            return list;
        }

	public int insert(final R row) {
        
            return 0;
        }

	public int insert(final L list) {
        
            return 0;
        }

	public int update(final R row) {
        
            return 0;
        }

	public int update(final L list) {
        
            return 0;
        }

	public int delete(final R row) {
        
            return 0;
        }

	public int delete(final L list) {
        
            return 0;
        }
	
	public void setPrincipal(final String name, final String password) {
		
		userAccess =  new BBDAPIPrincipal(name, password);
	}
}
